<?php
namespace app\admin\model;

use think\Db;
use think\Model;
/**
* 
*/
class Admin extends BaseModel
{
	public function roles()
    {
        return $this->hasMany('AdminRole')->field("role_id");
    }


    public function getPageList(){
        return $this->field("ysy_admin.*, ysy_role.name as roleName")
            ->join("ysy_role","ysy_role.id = ysy_admin.role_id","RIGHT")
            ->where("ysy_admin.is_admin = 0 and ysy_admin.status>0 AND ysy_role.status > 0")
            ->order("ysy_admin.id desc")
            ->paginate();
    }

    public function getList(){
        return $this->field("id,name")
            ->where("status = 10 AND isAdmin = 0")
            ->select();
    }
}